package com.agann.util;

import com.agann.model.Memory;
import com.agann.model.Record;

public class RSI extends Memory {
	
	/**
	 * Type Code
	 */
	public static final String TYPE_CODE = "RSI";
	public static final String RSI_SCORE = "rsi_score";
	
	private int n;
	private RS_Util rs;
	
	public RSI(String code) {
		super(code);
		//TODO Add Exception Check
		String[] args = code.split("@");
		n = Integer.valueOf(args[1]);
		rs = new RS_Util(n);
	}

	@Override
	public void update(Record record) {
		rs.update(record.getClose());
		setScore(RSI_SCORE, 100-(100/(1+rs.getScore())));
	}

	@Override
	public void merge(String code) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void change(double rate) {
		// TODO Auto-generated method stub
		
	}

}
